package com.garlicts.excel;

import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class OrderVerifyHandlerImpl implements GarlictsExcelVerifyHandler<OrderExcelImportPojo> {
	
	@Override
	public Map<String, String> verify(OrderExcelImportPojo obj, int currRowNum, Map<String, Integer> fieldColumnNumMap, ApplicationContext applicationContext) {
		
		Map<String, String> errorMap = new HashMap<String, String>();

//		String consignerName = obj.getConsignerName();
//		System.out.println("consignerName="+consignerName);
//
//		StringBuilder stringBuilder = new StringBuilder();
//		Integer currColumnNum = fieldColumnNumMap.get("consignerName");
//		stringBuilder.append(currRowNum).append("_").append(currColumnNum);
//
//		if(StringUtils.isBlank(consignerName)) {
//			errorMap.put(stringBuilder.toString(), "客户未填写");
//		}else {
//			if(consignerName.length() > 20) {
//				errorMap.put(stringBuilder.toString(), "客户名称过长，超过20位");
//			}
//		}
//
//
//		String consigneeContact = obj.getConsigneeContact();
//
//		StringBuilder stringBuilder2 = new StringBuilder();
//		Integer consignerContactColumnNum = fieldColumnNumMap.get("consigneeContact");
//		stringBuilder2.append(currRowNum).append("_").append(consignerContactColumnNum);
//
//		if(StringUtils.isBlank(consigneeContact)){
//			errorMap.put(stringBuilder2.toString(), "发货人不能为空");
//		}

		return errorMap;
		
	}

	@Override
	public String execute(OrderExcelImportPojo orderExcelImportPojo, int currRowNum, Map<String, Integer> fieldColumnNumMap, ApplicationContext applicationContext) {
		return null;
	}

}
